static functions for usort
db handler
store result into DB