I can go no specific advice, as theres no code available in this thread but my guess would be that you don’t need 3k lines of code for the things I see in the YouTube video.
And to the topic of linking other widget components - it seems that for example the keypad remote part of the widget could be linked, as this doesnt need a mandatory connection to the rest of the elements: