Fixes Lights behaviour and adds tests

Cleaned the commits to avoid useless diff