added autoscroll functions to code