Fixed remainder

Fixed the remainder so it doesn’t over-calculate.