some useful code fragments