clean up edit code