added keyboard interrupt to server and moved main into server