fix function type (add private)
add sort capabilities for results in sqlitedb
actually use result sorting