Replaced stubs with functional code and added comments per assignment
instructions.