further cleanup and documenting