Migrate code to use the BlockContext