Code before redoing layout