Added error checking for GUI