Refactor stats controller.
Merge pull request #45 from bahartmann/master

Refactor stats controller.