Functions I needed that may be useful to others.