cleaner way to get the number of cores