As i already said, it is needed to have that refheight, because the transaction could be included later on and your wallet need to be locked until the transaction is confirmed also it wont be possible to empty wallets in a exact way, because the amount available is lower than the original. Maybe you want to contact @jtimon he maybe can explain it better than me..
And no, sadly there is no guide to modify bitcoin in the way needed ;-) ..