rework generic mess to use java8 features