A couple of homemade functions I find useful.