Redo r47313 in a more readable way (probably more efficient too) by not using all...