Added else-if for special case in == 0.
Changed output function accordingly.