Sale of Primary Residence after 18 months

I sold my primary residence in April 2022 and took advantage of the capital gain exclusion. I purchased another home in March 2022 which I lived in until October 2023 at which point it was sold. I don't meet the criteria for a partial capital gains exclusion so I will pay capital gains tax on the sale.

Let's say I purchased the home for $175,000, had $3,000 in closing costs and spent $5,000 on improvements (painting & landscaping). Does this increase my basis to $183,000?

If I sold it for $210,000 and had $12,000 in commissions & other closing costs, my gain would be $198,000 - $183,000 = $15,000

Is this a correct interpretation of the costs I can deduct?

Thanks