Additional tests and conditions, properly handling precedence