Refactored some code and added animate and speed options