Added generic sorting function .... first step has passed, more tests are needed.