Still working on it... The cast_to_primitive_version works but doesn't set the blocks exactly how I'd like it to. The sorting function should take care of all duplicates anyway.