Capital gains tax - Calculation of gains and allowable deductions