moving changes from java_rewriting_engine4 branch

Probably shouldn't be necessary -- I probably overused [function] a bit.