first functional version with new structure. Ready for refactoring.