Messed with pattern checking to work with polymorhpic types