Light: Factorize some code.