add js from josh welker
move js to be first in function