Refactoring constructor for instancing variables only before they get used and for better code readability.