moved jam stuff into util to avoid circular dependenices