Basis Calculation LLC with new S-Corp Election?

Hello, I'm looking for some help on calculating end of 2018 shareholder basis for a business operating in 2017 as a SMLLC and as an SMLLC with an S Corp election effective 2018, plus a few other related questions.  

Pre-S Corp Election Contributed Capital (2017):  $A

Post-S Corp Election Contributed Capital (2018):  $B

Pre-Election losses, flowed through to personal return (2017):  ($C) - assume not counted towards basis?  Does retained earnings go to zero for 2018 beginning balance on my S Corp 2018 balance sheet?  What would the journal entry be for these retained earnings to zero out?

Pre-Election Section 179 Carryover of disallowed deduction, carried forward due to NOL:  $D

Post-Election NOL for 2018:  ($E).  I assume I can take the loss on my 2018 personal return against other income and I do not have to carry forward the loss as my basis remains positive if calculated in the method shown below?  

No loans, distributions, or wages up to now.

Proposed basis calculation:  $A + $B + ($E)

And in the year with sufficient revenue that I take the Section 179 depreciation expense (should be this year), -$D to my basis calculation.

Can I continue carry over the pre-election Section 179 to a future tax year that has sufficient net income?  Any other recommendations on this basis calculation?

Thanks!