more advance example with samples