Refactor madness.