Move lookup dec outside if block