Proper cleanup and path choosing.