Miscellaneous refactorings