Commented function code

Function code with comments
Test results as run attached and commented out