It took me a bit to understand what it does, so I decided to leave some
comments. This is by no means everything that could and probably should
be documented here, but it's a step in the right direction.
Change-Id: I6cf4b7e6aac63bd36d1486e9669836c703e078a3