Completed code for assignment