Added some more logging.
Switched input.param with input.query in distinct function.