lol, did you forget what your while loops are doing? ;P
look over your code again, you're not just checking $me == $2. you're checking each parameter from 1 to the one that corresponds to the position of the mode. so in the +ko $me example, you check both $1 and $2 against $me