Minor code cleanup.
Used templates for views. Improved animation.