Updated to avoid content flash and to allow better interaction with external applications.