First commit, parts 1-3