add docs and remove dead code