Added couple of small functions to cut down on code duplication