Remove unused vars and add phpdoc