move GUI access out of thread