refacctored so change could reuse all function of edit