improvements on generate