Important note:

last commit also fixed the gui to be more thread safe