ESD now uses correct temporary files
Improved naming and added docstring to method