fixed greediest analysis

and took out all the bugs that Brett Calcott put in.