generic utilities used by the topl code in jstar