example code for BAM blog post