UI code fixes for resizing, also fixes and enhancements in main class, generic version to come soon.