Shareholder/Corporation Basis in Property??? is this right

Hey can anyone let me know if I am doing the formation of a corporation, I will be making up a fact pattern ( I am worried ill get a sim on this) There are two partners who form a corporation each owing a share (50%) , so they will have to report a recognized gain if it applies? If one of the shareholders in question owned 80% they would not! Shareholder A contributes Land with a Fair Market Value of $40,000; Adjusted Basis of $20,000, and Cash of $5,000 contributed to corporation; secured by a liability of $5,000 A: would have a realized gain of $20,000; recognized gain of $0; and his basis in the newly formed corporation will be $20,000 ( Adj Basis+ Cash- Liability assumed by corporation) If cash was received by Shareholder "A" this would be deducted from the calculation of a gain Corporations Basis: A's Basis: $20,000 Shareholder B contributes a building with a Fair Market Value of $50,000; Adjusted Basis of $30,000 secured by a mortgage of $40,000 B: would have a realized gain of $20,000 (FMV- Adjusted Basis); recognized gain of $10,000 (Adjusted Basis- Mortgage); and a Basis in new corporation of $0 (since liability exceeds Adjusted Basis). Corporations Basis: B's Basis: $0 + Gain $10,000. Conversely if this where a partnership each partner would decrease their partnership by the amount of liabilities that the other partners are assuming; and you would still use Adjusted Basis. My question is was I correct overall? But more specifically in the calculation of the Corporations Basis?