move editing function to seperate file