adding comments and cleanup