Adding more documentation about this code at ab's request :)