Replace math fns with simpler integer math