#4 some refactoring