code before adding region