updated for new xray and pretest functions