switching over to function based sorting