working version with 5000 as sample size