split generate method into smaller chunks