Adding options to middleware, now returns a function, adding mapParams and filterParams opts
Updating tests