Working gen code
Working gen code