Fully commented the code