Forgot what I just said. I got this working :

http://codepad.org/mcY4K7Sf

Do anyone see any blatant misses in this ?