Reduce DOM writes

Probably not necessary, but scans pre-existing sources instead of
building new ones. Seems to simplify the code except for the redundant
listing of MIME types.