Why does this solution work?