Fixed all issues and commented the cpp