improve gitgutter integration and algorithm