Store stock sorting function