Improve tests and CmdLine.hs, only refs are left