Increased precision in output and fixed a bug in the greedy algorithm.