Factor helper methods out