best attempt at greedy