See above about moving the code for this function directly here.