First commit. Working, but clumsy.