modifying the server function
function optimization