re #9627 Completed all of the algorithms but bear in mind the comments