added initial support for large sample sizes