rework API for java 8