Cleaning up code and getting page transitions to work