Several refactors.