Removed unused import
Refactoring to convert messages to JSON