BUT, are you aware that the exempted gain must be reduced by proportion of non-primary residence period / total ownership time?
Let's say your gain is 500k, and you lived in the house 2 years (any time) out of 5 years of ownership, you are only entitled to 200K of exempted gain. the 3/5 of the gain is not exempted from capital gain.