Refactoring client js to be served in separate file