Added phpdoc hints
Code cleanups and removal of debug statements