Improve window UI code, use ConfigNode for configuration saving, save window state to file (fixes #2)