Those shells are sharing most part of the codes. Better to consolidate them some way.