Added separation of type and error