used yield instead of block