Clean up and added documentation.