better comparison for various types