ranks added, code improved, diff added via "Diff Match and Patch" from Google under Apache License

ranks added, code improved, diff added via "Diff Match and Patch" from Google under Apache License