minor logic changes