Added logging to distinct function.
Corrected distinct input to function call.