Had initially checked in the wrong code. Here is the right one.