Example and reorganizing the code