Did further refactoring to use guava more efficiently.