Changed couts to printf since printf is atomic to other printf's