moved the instantiation of lifx, lx, before function