Added new input flags
separated out animation code and improved controls