Initial commit of functions Erik gave me.