Rework code based on assignement spec.