Tidy up Code before Update