Add generator and simplify generate script