minor refactoring to improve readability