lots of gapfill code, optimising plex choice