Updated to retrieve non-string elements too.