refactorings - we are almost ready for unit tests