updated hsServer code