Updated to allow easier overriding by the user.