adding categories and error handling