Sort option for public api
code enhancement