Refactor commit check