Update challenge4 to have functions and remove parsing from main