Cleaned up code and documentation