refactoring of rounding