Cleaned up some code and documentation