Cleanup and more documentation. Minor bug fixes