Provided checking on empty constructor argument.
Code refactoring(converting some conditions in functions).