small refactoring - extract functions and indentation