Move javascript to separate file