Break out animation into its own function, change handling so it sends json