create helper function