changed cleanup deleted to trashed
altered function for detecting gd version
several changes