Call a function based on its type?