Replaced Thread.sleep by block, much less of a kludge now