Removed dead code; fixed phpdoc

There is a lot of undeclared properties, I've declared them and added few missing phpdocs. I've also removed dead code.