changed Math.floor to ~~ which is faster