replaced floor with int typecast, which is what we want anyway