fixed code to match explanation