I don't understand the purpose of index. There is a .type() method that returns the InputType. I don't think index() should be checked against InputType at all?