updated to use hash