add some docs and remove some dead code