finished assignment code