reworked for java8