initial scaffold copy from hgmmpfork, as it was unwieldy and should not be a formlibrary