Better upgrade code?