I have modified the code to accept a single config param. Changes can be done later to make the function generic (If multiple config params are possible)