Complete remainder, bug fixes