Added functional cock-tail sort part