Added some permission checking when editing