First half of generate command