Part 1 (minus logging) complete.