Finally got around to starting the rewrite of the index.php from hell I took over earlier in the year.