Got rid of dependency on Math.floor, 699 characters
Some random efficiencies, 690 characters