working copy
Improve the performance from 20ms to <1ms
still got some unittest to do