refactoring and fix result values