moved sorting logic to a writer class, renamed printer to reader