Updated Generation Code