reformatting and circuit solver