Port to 1.7 and move stuff around for use in IDEA and gradle.