Fixed some minor issues and added comments