Created functions.

I replaced the stub with the functions that fulfill the assignment and
comments that describe what they do.