Working version of assignment.  Performs operations as intended.