Added nil checkers for controller