Updated Circuit Generator Code