implemented some exception throwing