Pulled histogram into own function