Added a bin counter and some unit tests to facilitate organizing the samples.