updated functions for assignment
Merge https://github.com/stenbein/ProgrammingAssignment2