Added factory methods to create condition and latch