added remainder function