added server loop