Changed '1 << way_width' to 'ways'. Sizes of count arrays are now divided by the number of ways. Problem with file name string fixed.