Improves errors and JSON export