moved code back to java 7