firefox animations and tidy some code