A bunch of cleanup and docs