use stack matching