working stage. starting refactoring