Beginnig the sorting into categories method