Try to do code factoring on gui stuff.