continued refactoring, suggestions applied from intellij