Fixed hash1 function and improved multi