Changed cleanup method to work with multiple paths for Craig's working version