updated server side code