Externalised common functions of the mv machines.

This avoids code duplications and helps to define new mv machines