moved is editing checking into a function