added some code for submao shifting