Implement more complete function name inference