Added functions with comments.

Tested the functions and they correspond to intstructions given.

Signed-off-by: Lars <ponteira@users.noreply.github.com>