Started to segment the code into pieces