refactored drying process