improvement and rewiring support added