Move some utilities to lights.h