Refactor THIE
Add one more unit test