refactor util.seqdiff, trying to make it a bit more extensible