Why are you comparing eil to both a and b in your inner and outer loop? Is that really what you want to be doing in your inner loop?