moved js to end of code