Paste all reusable code for future reference here