minor refactoring to improve the code quality