refactored gui sysout to separate function