added condition variable