turned read into gets, made a function