more refactoring of gui