Move histogram functions into a separate file.