modified to a function form for use within CASA
rename