changed server loop