added remainder function using modulus