Big Refactor. WIP commit.