sleep invoked by condition, improved way of retrieving rows