Move scrolling code out of main.py.