No, this is probably going to be necessary. Unfortunately ordering of code isn't something that is easy to do and Dreamweaver doesn't really tackle the subtleties of it at all in their API. There are just some cases where moving code up or down manually are necessary, and this appears to be one.