Do function ids in a much smarter way.