Update docs, remove some duplicate code.