finished code to review confusion