fix bug, clean up comments