Refactor things a bit.