Pattern match instead of calling head/tail