Optimized animation frame function
Small fixes
Optimzied frame tick