small refactoring for better design