architecture refactoring, fixed rounding error