UPDATED modernize with proper use of "auto" to determine variable type without sacrificing readibility