Some useful code snippets for processing