clean up, comments, bug fixes