extract out helper functions to a helper file