made server a thread