added better json message generation