Deductions & credits

I'm confused about (1). My cost basis is purchase price + fees at the time of purchase. My depreciation basis for the rental was the Fair Market Value because at the time it was converted to rental its FMV was _significantly_ lower than the purchase price (after 2008 crash).

So, my gain should be selling price minus sale expenses minus taken/allowed depreciation minus purchase price minus purchase fees, right?

And then according to (3) I can also subtract refinance fees incurred while renting it?

 

Also, do the refinancing fees (incurred during the rental period) include only title/recording and such, or can loan-related fees also be included (origination/broker fee, appraisal, etc.)?

 

Thank you!