Moved some inner function to UIController.prototype level