refactored gui update method