Global refactoring, prepare to write gitlabhq support