Externalised common functions of the mv mashines.

This avoids code duplications and helps to define new mv machines, this pull request has the fixed commit message of https://github.com/RealBadAngel/technic/pull/68