Updated to work with JDK 1.6