Refactored leaderboard code and added jasmine tests.
Merge branch 'Sanjo-refactoring-and-jasmine-tests'