Sorted out the directory iterator madness
Attended to a few obvious memory leaks