cleaned up and added isEdited var