merged scratchio from master
still needs to be changed to work with Qt