copy of the source from the jtr package