Moved animate call to js method and cleaned up js