Remove unused code and add more docs.