small changes in readers writers algorithm