Separated non-drawing logic for lightning.