From your questions here and here, I strong recommend you get a knowledgeable CPA to do your taxes. He or she will be worth every penny you pay.
I'm not an expert, I leave this sort of stuff to my CPA. But I believe the way this works is that your basis for the property starts at the price you pay, plus all costs associated with the acquisition.
Then, if you fix it up before putting it into service, those costs add to the basis.
Once its in services, repair costs do not add to the basis, but capital items do.
The improvements are subject to depreciation. There's an overall depreciation as well as depreciation on individual items. The individual items (e.g., carpets) are usually at a faster rate than the overall improvements.
All depreciation (taken on your takes or not, per the other thread) reduces your basis.
When you sell, the sales price is reduced by the cost of making the sale. Title insurance and other closing costs. Not the payoff on your loan, that's irrelevant. There may be points, though, that can all be taken at the time of the sale.
Then, you subtract the basis from the adjusted sales price to get to your net gain. The amount of that gain up to the amount of depreciation taken (or that could have been taken) is subject to depreciation recapture tax. The remaining gain (if any) is subject to capital gains tax.
You should save every receipt and scrap of paper and give it all to your accountant and let him or her figure out all the details.