Simnplify the scala version of the chapter six example to only use one broadcast value and move slightly more logic to a helper function