optimized imports, replaced some logic by java8 lambda expressions