Changed to Java7 compatible code.