Improve documentation, remove dead code