refactored.  Temrinal window old version
merged