Separated lighting from block code, refactored things.
Possible fix for safe sometimes crashing during activation after upgrading.