General refactor.