frame animation and refactoring