refactorings to support arrays