now works with more types