Start to refactor a bit.