Circuit_xxx code cleaned up