Better handling of multiple blocks (previous version didn't even assign
blockid other than zero)