Reformats imports and defines better hash and __eq__