Improving gui handling