added sorting algo