some small additions, small corrections, small refactors