TODO: 2014/11/24

BM algorithm to be finished.