Added editing and permission checking