                       buffer.push wrapper
                   # using watch is the only way I found to gather the 'real' height of the thing - the height after the item
                   # template was processed and values inserted.
-                  itemScope.$watch 'whatever', ->
+                  itemScope.$watch 'heightAdjustment', ->
                     if top
                       newHeight = topPadding.height() - wrapper.element.outerHeight(true)
                       if newHeight >= 0
                         topPadding.height(newHeight)
                       else
-                        viewport.scrollTop(viewport.scrollTop() - newHeight)
+                        scrollTop = viewport.scrollTop() + wrapper.element.outerHeight(true)
+                        if viewport.height() + scrollTop > canvas.height()
+                          bottomPadding.height(bottomPadding.height() + viewport.height() + scrollTop - canvas.height())
+                        viewport.scrollTop(scrollTop)
                     else
                       bottomPadding.height(Math.max(0,bottomPadding.height() - wrapper.element.outerHeight(true)))
+                    console.log "item = " + wrapper.element.text()
+
+                  itemScope
+
 
                 finalize = ->
                   pending.shift()

                fetch = () ->
                  direction = pending[0]
                  #console.log "Running fetch... #{{true:'bottom', false: 'top'}[direction]} pending #{pending.length}"
                  if direction
                    if buffer.length && !shouldLoadBottom()
                      finalize()

                          finalize()
                          return
                        for item in result.reverse()
                          lastScope = insert item, true
                        first -= result.length
                        console.log "prepended #{result.length} buffer size #{buffer.length} first #{first} next #{next}"
                        finalize()
                        lastScope.$watch 'adjustBuffer', ->
                          adjustBuffer()

                viewport.bind 'resize', ->
                  adjustBuffer()
