Edited the funcions in my fork of R Peng's git repository to complete the assignment in a structure similair to the example functions.