applied some duck typing