Slight optimisation.  Don't need math as a local.  math.floor is the only function used so make that the local instead.