Started off by trying to fix all the notices... But I gave up and just turned off error reporting.