finish edit functionality