Added support for intermediary animations and fixed some animation bugs

Also cleaned up code style