Refactor client side