Misc code chunks, examples and tests