Refactored gitlab script