Made the code of the round to nearest function more clear.