Fixed swing threading issues. Fixed GTK threading issues. Code cleanup