Logic for tab bar controller