Fix problems with java 8. Cleanup