Put some diagnostic functions into a separate file.