Added duck typing and tests