refactor swap_directories method; parallel assignment makes using a temp var unnecessary