applied minor refactoring