updated comments and corrected typos