final client side code