Refactored client side