Modified code to support latest framework changes.