near completion minus input validation stuff