Fixed variable scope to allow simultaneous scrolling

Fix for #58.

Fix for incorrectly scoped variables which prevented scrolling across multiple containers.