Replaced timer by synchronized queue to synchronize threads