better sample, decode functionality