[eluser]Thoer[/eluser]
I found a few things I'd suggest you to look at, but seeing that the unoptimised queries run for seconds, I'll probably go back to my version.
1. In codextemplates.php @ line 97 the code should be '$head = $this->content['head'];'
2. In codexforms the function 'callFuncOnObject' is probably out of use. Please doublecheck it, but I think it uses undefined variables and the second foreach loop seems to be outdated too.