Re-implemented existing code with updated Java 7.

In the process, I somehow managed to break the eclipse project.
However, it's back to functionality with Java 7.