Added method onHide to controller.
Renamed onShowed method to onShow and fixed functional of it.