Redoing some code.
Fixed previous functions according to rubric.