added some condition variable functionality