Found a pretty serious function body buffering problem. Not only is it now fixed, but the code is way way simpler.