Use direct generate function to avoid infinite loop