modified helper function to be all on one line