Add handling for medium trust environments