Fixed the build. Cleaned up some style issues. Added documentation.