Add minor changes for code clarity
Change offsetExists condition on 'values' to isset on 'keys'