updated database stuff, added sorting for the cards view