Adding docs. Cleaning some dead code.