Fixed a bunch of regressions introduced with the previous commit + added better method to flush the pending samples.
Updated the README file.