adding some comments and some cleanup