java 8 code cleanup, bugfixes