Robust DOM manipulation, comrade

This will allow the periodic stream check to go much easier.