shifting some code around to make way for non-xinetd support