refactored and added hashihg