added a second function to check for sorting alphabetically to make sorting optional