Added function that I thought wasn't needed when I extracted this code from my .bashrc file.