Develop

Refactored the code to have smaller methods and remove unused code