Shouldn't we rather use `r` instead of `record` in `insert_record`?