more refactoring, improving readability