added the code to create rowOrder array