useful code snippets for website functionality