onInit

Improving logic.