Refactor to better seperate concerns.
Merge changes.