Tidying up client code (index.js).