some code snippets and ideas