mostly automated cleanup & refactorings