Use variable instead of defining temp function