updated light logic