Both of these functions could use some refactoring.  We'll go over this problem in class next time and you can see what other students did.