replaced with a better wait/notify (latch)