cleaned up code and added animations