copying in willis code from session 4