Implemented and tested the new version of getSamples method