various and sundry refactors