separate main js, fix script inclusions