input implemented, sorting implemented