Refactored some common code into a helper file