gap: implement gap resolver