begin server and threads