Modified the code to use prepared statements on the client side