Various Javascript optimisations to get an smoother gameplay on mobiles