added additional functionality to calc_commute