finalize scrolling code and cleanup