Changed to Condition.wait() from sleep