More refactorings and linting.