do-block optimization