transfered all logic to server side