Moved JavaScript to separate file