Code snippets for "Mastering AA" blog post