cleanups and small refactors