Better documentation and minor cleanups