Sort algorithm now working.