Move JS code to external file