LED handling rewritten