add tompson algorithm