Code cleaning and added some ouputs