Added a proper ranking system, now also saved in the database.