Switched to using panic instead of returning errors for invalid types (closes issue #2)