Renamed two methods and rewrote the class for Java 6