This is really cool. I was trying to solve the same thing since long time and this is exactly i was looking for.