using yield instead of block