Code cleanup, fixed the history back bug, and added animations