Made animations work
Some refactoring