Preliminary movement

The basic logic is there, but it's untested and all the limits need to be evaluated.