Removed unused namespaces.
Added exception for delegate.