Extracting out helper functions to make writing more tests easier.