some corrections and added tests.php ref and output example