Cleanup and add documentation to threshold_arr and thresholded_arr.