Check properly for presence of PED filename argument
Massive removal of memory leaks