improve gap calculation