minor lightswitch code tweaks