change interface
modify build algorithm to less memory.