created torcircuit class and tidyup