smart function signature construction algorithm