Added PasswordToHashHexString and general refactoring