optimize: use hash instead of an arrary to store bracket level and address Yichun's comments