The procedure mostly works fine, just an off-by-one error that will be addressed later.
I realized the reason I was failing so hard before was that the map file wasn't configured correctly ><