added optional hash support