Clean up code and add auto scroll to top

Fix this