moved where I sorted the arrays