Add python test binding, clean up R binding, clean up Java code slightly