fix #6 by consolidating code snippets and their captions