added validatePHP functions and other modifications