Simplify __construct() method

Make it more simple and easy to read.
Simplify __construct() method more
Merge pull request #3943 from malukenho/patch-2

Simplify __construct() method