PHPDoc, CS, mistake fixes and other minor improvements

@sandeepone Also need merge to Gleez repo
@sandeepone It seems this logic need remove