Console version in Java, works with my sample dataset at least