Refactored statistics page and some APIs