Using hash for type conversion