Adds remainder function