hash and typeinfo refactoring