Refactor HktSdk. Write more test cases