refactor handling string or array classes