What does the code do and how does it work?