Refractoring and circuit class added