Updated variable parsing regex to support "." in variable names
Updated search for max_id to support case where max value appears more than
once