Code cleanup based on PhpStorm inspector