Refactor of client side