removed elsif statements from merge, updated recursive sort for better handling