insertBefore instead of prependTo
Bunch of fixes