sort snippet code