class handles multiple possible patterns