implement QResStack and result types