This should not be global but passed as an argument.