Working version of metgapfill