added functions and loop to cycle through retreiving inputs