added the update item functionality
fixed the sorting issue