Refactor and move to Java 8