Serious refactor.