I spent 6 hours today trying to figure out how the author is getting a function