refactoring calculate percent value