Refactor preview hash computation