Refactoring pt 1
Back to funtional
Finished refactoring