Fixed PHP 5.3 errors and changed how its called