changed bitwise operation to Math.floor()