clean up and add better comments
docs fix