Refactor git handler