This is the thesis of tungvn and toantk