more simplification of previous code, generalize for m1 specifics