Adds distinct order functionality