changed the functions so that it actually samples correctly now. The previous
method was incorrect