Created script file with sorting function