finished algorithims