Cleaning the code and creating a structure