finished code portion of assignment