Minor style and performance issue: data types that are used for addressing (accessing), replaced by size_t.
Minor performance issue: eliminated sub-condition.
Minor style issue: eliminated not necessary variable.