some more code smells and refactorings