Added custom subcircuit handling