Some minor logic tidying