improved speed of adding and fixed bug