Use hash to improve performance