Remove unused functions, improve javadoc