Clean up process_message to reduce KeyErrors