Fix PHPDoc
Re-order logic to make more readable