Add some basic integration tests
Some refactoring on the client-side JS