Code snippets and miscellaneous