karma: use the database to organize more effeicent

Currnntly displays the list out of order
karma: new query results now sorted
karma: pyflakes cleanup
Merge branch 'karma_better_queries'