Small optimizations

+ Added option to disable casting for gesture detection (not needed for the game)
+ Removed some continuous unnecessary memory allocation