Improve commenting, fix some test issues