Please look at this code. 
http://pastie.org/8918909
As I said earlier your code does not work. Please look at this screenshot:
https://ubuntuone.com/1EMfpnKEokH6B1iBqiFoiu
In this situation your suggestion does not work.