Refactored to functional style using guava