Added logic to prevent unauthorized edits