Added a minimum number of commits to sample. And a littel refactoring.