Adding mask generation function. Completed dual block tests.