added function to get number of cores