Basic code comments along with minor code refactoring