removed unnecessary couts, program exits with critical section error?!