Revert "Move JS to end of file"

This reverts commit 87090af92012fc48a88086f66566166a2676747b.