moved client side logic to server side