Rename categories.json to statistics.json
Return correct statistics when receiving such message.
Move the code for calculating ratings into a separate module.