Cleaning up and adding documentation.