Clean up gui code