a lot code for remembering settings and for nogui computing