Removed duplicates and added some comments