replacing cout with cerr