Integration

Clean-up, add tests and integrate the leaderboard code (found in stats/index.php)