add initial documentation and fix compiler bugs