Some bugfixies and add category showing
Optimize SQL queries