Moved dump file preparation to separate method

This will help to run this in advance later to speed up processing.