updated helper function