Minor logic changes