Moved all script tags to the bottom.
Initial version of 1:M support.

Very fragile. Needs improvements.