simplify chash method
Optimize some operations