modified to comply with JDK 1.7