Some optimizations to improve the framerate