Java 6 compatibility changes

These changes should preserve compatibility with Java 6. We may not want to go down this road, so please hold off merging for now, until discussion in issue #136 is complete.