Big refactor, divide tsmf into tb and mf

作者：     Man YUAN <epsilonyuan@gmail.com>