Updated the sorting and editing