Some code snippets written and used, may be useful.