Added append sorted test code