some useful snippets & functions