code refactoring for enhancement