Refactor positive and negative gate expansions.