Add wrong input check and base for sorter class