Moved js code to a new file