use test instead of match for performance