lights2 is soret-of working

add output scheduling and optimisation, mostly working