Updated java code. Still has Lance bug.