Cleanup code for java 1.7