pulled all of the functions out of main for hw2