In fact I don't really understand why you need all this change... reading the rest of the code.