the prisoner’s programmatic needs, the prisoner’s mental and medical health needs, any request made by the prisoner related to faith-based needs, recommendations of the sentencing court, and other security concerns of the Bureau of Prisons, place the prisoner in a facility as close as practicable to the prisoner’s primary residence, and to the extent practicable, in a facility within 500 driving miles of that residence. The Bureau shall, subject to consideration of the factors described in the preceding sentence and the prisoner’s preference for staying at his or her current facility or being transferred, transfer prisoners to facilities that are closer to the prisoner’s primary residence even if the prisoner is already in a facility within 500 driving miles of that residence.