Added PHPdoc

(and some other small code corrections)