Simplify some classes and also add test class.
Used java8 grammar.