misc cleanups and DRY