Added error checking for calls to generate