refactoring warning calculation