Programming Assignment 2 functions written and commented