Replaced trigger_error() calls with Exceptions