updated rake task algo also