refactoring for code readability