See QMC branch scriptoverhaul for changes.