added a ToxLoop class based on tornado