Multi-instance support

Only works in the GUI for now, doesn't break  the command-line client but the new options are not implemented.

Related to #29 
This is the correct way to set the current instance. The previous comment was a hack to get the command line client to work.