Added functionality to generate() and started testing