added logic on server side