now with a histogram and tidying up!