Clean up and directory change