adapted from expQml