Improve documentation. Remove unused functions.