Minor changes to the internal functions.