Made pGen a smart pointer in main