Updated ksort in delete method.