More cleanup

No functional changes since commit 1, but more cleanup and doc revision.
Added license.