Refactor and documentation clean up.