Updated replias2array function