Change messages structure
Fix JSON errors
Fix some formatting / indentation