Edit and update working, plus DRYed up code