minor refactorings to improve the code quality