simplified code using the new java 7 APIs