Refactored as CodeClimate was giving a negative score on to many params in a function.