General code snippets and tests