Adding code from old repo, big commit.