Added comments, some minor code changes

Minor code cleanup