separate matching and tree definition