Generic refactor.