updated for editing an existing record